Theorem

Suppose a random variable XX.

If a probability distribution of XX is discrete, and one knows its probability mass function pXp_X, then expected value of g(X)g(X) is

𝔼[g(X)]=xg(x)pX(x)\mathbb{E}[g(X)] = \sum_x g(x) p_X(x)

If a probability distribution of XX is continuous, and one knows its probability density function fX(x)f_X(x), then expected value of g(X)g(X) is

𝔼[g(X)]=g(x)fX(x)dx\mathbb{E}[g(X)] = \int _{-\infty }^{\infty }g(x)f_{X}(x)\,\mathrm {d} x

References

  1. https://en.wikipedia.org/wiki/Law_of_the_unconscious_statistician